{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from autogen import AssistantAgent, UserProxyAgent,ConversableAgent\n",
    "from autogen import Cache\n",
    "config_list = [\n",
    "  {\n",
    "    \"model\": \"qwen2:7b\",\n",
    "    \"base_url\": \"http://localhost:11434/v1\",\n",
    "    \"api_key\": \"ollama\",\n",
    "  }\n",
    "]\n",
    "llm_config = {\"config_list\": config_list}\n",
    "import os\n",
    "\n",
    "from autogen import ConversableAgent"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/anaconda3/envs/ChatTTS/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
      "  from .autonotebook import tqdm as notebook_tqdm\n"
     ]
    }
   ],
   "source": [
    "import autogen\n",
    "from autogen.agentchat.contrib.retrieve_assistant_agent import RetrieveAssistantAgent\n",
    "from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "assistant = RetrieveAssistantAgent(\n",
    "    name=\"assistant\",\n",
    "    system_message=\"You are a helpful assistant.\",\n",
    "    llm_config=llm_config,\n",
    ")\n",
    "\n",
    "ragproxyagent = RetrieveUserProxyAgent(\n",
    "    name=\"ragproxyagent\",\n",
    "    retrieve_config={\n",
    "        \"task\": \"qa\",\n",
    "        \"docs_path\": \"readme.md\",\n",
    "        \"get_or_create\": True\n",
    "    },\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2024-07-24 06:59:33,212 - autogen.agentchat.contrib.retrieve_user_proxy_agent - INFO - \u001b[32mUse the existing collection `autogen-docs`.\u001b[0m\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Trying to create collection.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2024-07-24 06:59:36,276 - autogen.agentchat.contrib.retrieve_user_proxy_agent - INFO - Found 2 chunks.\u001b[0m\n",
      "2024-07-24 06:59:36,294 - autogen.agentchat.contrib.vectordb.chromadb - INFO - No content embedding is provided. Will use the VectorDB's embedding function to generate the content embedding.\u001b[0m\n",
      "Number of requested results 20 is greater than number of elements in index 2, updating n_results = 2\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "VectorDB returns doc_ids:  [['71d0b170', '47b63d39']]\n",
      "\u001b[32mAdding content of doc 71d0b170 to context.\u001b[0m\n",
      "\u001b[32mAdding content of doc 47b63d39 to context.\u001b[0m\n",
      "\u001b[33mragproxyagent\u001b[0m (to assistant):\n",
      "\n",
      "You're a retrieve augmented chatbot. You answer user's questions based on your own knowledge and the\n",
      "context provided by the user.\n",
      "If you can't answer the question with or without the current context, you should reply exactly `UPDATE CONTEXT`.\n",
      "You must give as short an answer as possible.\n",
      "\n",
      "User's question is: What is autogen?\n",
      "\n",
      "Context is: Autogen enables the next-gen LLM applications with a generic [multi-agent conversation](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) framework. It offers customizable and conversable agents that integrate LLMs, tools, and humans.\n",
      "By automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code.\n",
      "\n",
      "Features of this use case include:\n",
      "\n",
      "- **Multi-agent conversations**: AutoGen agents can communicate with each other to solve tasks. This allows for more complex and sophisticated applications than would be possible with a single LLM.\n",
      "- **Customization**: AutoGen agents can be customized to meet the specific needs of an application. This includes the ability to choose the LLMs to use, the types of human input to allow, and the tools to employ.\n",
      "- **Human participation**: AutoGen seamlessly allows human participation. This means that humans can provide input and feedback to the agents as needed.\n",
      "\n",
      "For [example](https://github.com/microsoft/autogen/blob/main/test/twoagent.py),\n",
      "\n",
      "```python\n",
      "from autogen import AssistantAgent, UserProxyAgent, config_list_from_json\n",
      "# Load LLM inference endpoints from an env variable or a file\n",
      "# See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints\n",
      "# and OAI_CONFIG_LIST_sample\n",
      "config_list = config_list_from_json(env_or_file=\"OAI_CONFIG_LIST\")\n",
      "# You can also set config_list directly as a list, for example, config_list = [{'model': 'gpt-4', 'api_key': '<your OpenAI API key here>'},]\n",
      "assistant = AssistantAgent(\"assistant\", llm_config={\"config_list\": config_list})\n",
      "user_proxy = UserProxyAgent(\"user_proxy\", code_execution_config={\"work_dir\": \"coding\", \"use_docker\": False}) # IMPORTANT: set to True to run code in docker, recommended\n",
      "user_proxy.initiate_chat(assistant, message=\"Plot a chart of NVDA and TESLA stock price change YTD.\")\n",
      "# This initiates an automated chat between the two agents to solve the task\n",
      "```\n",
      "\n",
      "This example can be run with\n",
      "\n",
      "```python\n",
      "python test/twoagent.py\n",
      "```\n",
      "\n",
      "After the repo is cloned.\n",
      "The figure below shows an example conversation flow with AutoGen.\n",
      "![Agent Chat Example](https://github.com/microsoft/autogen/blob/main/website/static/img/chat_example.png)\n",
      "\n",
      "Alternatively, the [sample code](https://github.com/microsoft/autogen/blob/main/samples/simple_chat.py) here allows a user to chat with an AutoGen agent in ChatGPT style.\n",
      "Please find more [code examples](https://microsoft.github.io/autogen/docs/Examples#automated-multi-agent-chat) for this feature.\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "\n",
      "## Enhanced LLM Inferences\n",
      "\n",
      "Autogen also helps maximize the utility out of the expensive LLMs such as ChatGPT and GPT-4. It offers [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification) with powerful functionalities like caching, error handling, multi-config inference and templating.\n",
      "\n",
      "<!-- For example, you can optimize generations by LLM with your own tuning data, success metrics, and budgets.\n",
      "\n",
      "```python\n",
      "# perform tuning for openai<1\n",
      "config, analysis = autogen.Completion.tune(\n",
      "    data=tune_data,\n",
      "    metric=\"success\",\n",
      "    mode=\"max\",\n",
      "    eval_func=eval_func,\n",
      "    inference_budget=0.05,\n",
      "    optimization_budget=3,\n",
      "    num_samples=-1,\n",
      ")\n",
      "# perform inference for a test instance\n",
      "response = autogen.Completion.create(context=test_instance, **config)\n",
      "```\n",
      "\n",
      "Please find more [code examples](https://microsoft.github.io/autogen/docs/Examples#tune-gpt-models) for this feature. -->\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "\n",
      "## Documentation\n",
      "\n",
      "You can find detailed documentation about AutoGen [here](https://microsoft.github.io/autogen/).\n",
      "\n",
      "In addition, you can find:\n",
      "\n",
      "- [Research](https://microsoft.github.io/autogen/docs/Research), [blogposts](https://microsoft.github.io/autogen/blog) around AutoGen, and [Transparency FAQs](https://github.com/microsoft/autogen/blob/main/TRANSPARENCY_FAQS.md)\n",
      "\n",
      "- [Discord](https://aka.ms/autogen-dc)\n",
      "\n",
      "- [Contributing guide](https://microsoft.github.io/autogen/docs/Contribute)\n",
      "\n",
      "- [Roadmap](https://github.com/orgs/microsoft/projects/989/views/3)\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "\n",
      "## Related Papers\n",
      "\n",
      "[AutoGen](https://arxiv.org/abs/2308.08155)\n",
      "\n",
      "```\n",
      "@inproceedings{wu2023autogen,\n",
      "      title={AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Framework},\n",
      "      author={Qingyun Wu and Gagan Bansal and Jieyu Zhang and Yiran Wu and Beibin Li and Erkang Zhu and Li Jiang and Xiaoyun Zhang and Shaokun Zhang and Jiale Liu and Ahmed Hassan Awadallah and Ryen W White and Doug Burger and Chi Wang},\n",
      "      year={2023},\n",
      "      eprint={2308.08155},\n",
      "      archivePrefix={arXiv},\n",
      "      primaryClass={cs.AI}\n",
      "}\n",
      "```\n",
      "\n",
      "[EcoOptiGen](https://arxiv.org/abs/2303.04673)\n",
      "\n",
      "```\n",
      "@inproceedings{wang2023EcoOptiGen,\n",
      "    title={Cost-Effective Hyperparameter Optimization for Large Language Model Generation Inference},\n",
      "    author={Chi Wang and Susan Xueqing Liu and Ahmed H. Awadallah},\n",
      "    year={2023},\n",
      "    booktitle={AutoML'23},\n",
      "}\n",
      "```\n",
      "\n",
      "[MathChat](https://arxiv.org/abs/2306.01337)\n",
      "\n",
      "```\n",
      "@inproceedings{wu2023empirical,\n",
      "    title={An Empirical Study on Challenging Math Problem Solving with GPT-4},\n",
      "    author={Yiran Wu and Feiran Jia and Shaokun Zhang and Hangyu Li and Erkang Zhu and Yue Wang and Yin Tat Lee and Richard Peng and Qingyun Wu and Chi Wang},\n",
      "    year={2023},\n",
      "    booktitle={ArXiv preprint arXiv:2306.01337},\n",
      "}\n",
      "```\n",
      "\n",
      "[AgentOptimizer](https://arxiv.org/pdf/2402.11359)\n",
      "\n",
      "```\n",
      "@article{zhang2024training,\n",
      "  title={Training Language Model Agents without Modifying Language Models},\n",
      "  author={Zhang, Shaokun and Zhang, Jieyu and Liu, Jiale and Song, Linxin and Wang, Chi and Krishna, Ranjay and Wu, Qingyun},\n",
      "  journal={ICML'24},\n",
      "  year={2024}\n",
      "}\n",
      "```\n",
      "\n",
      "[StateFlow](https://arxiv.org/abs/2403.11322)\n",
      "```\n",
      "@article{wu2024stateflow,\n",
      "  title={StateFlow: Enhancing LLM Task-Solving through State-Driven Workflows},\n",
      "  author={Wu, Yiran and Yue, Tianwei and Zhang, Shaokun and Wang, Chi and Wu, Qingyun},\n",
      "  journal={arXiv preprint arXiv:2403.11322},\n",
      "  year={2024}\n",
      "}\n",
      "```\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "\n",
      "## Contributing\n",
      "\n",
      "This project welcomes contributions and suggestions. Most contributions require you to agree to a\n",
      "Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\n",
      "the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.\n",
      "\n",
      "If you are new to GitHub, [here](https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution) is a detailed help source on getting involved with development on GitHub.\n",
      "\n",
      "When you submit a pull request, a CLA bot will automatically determine whether you need to provide\n",
      "a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\n",
      "provided by the bot. You will only need to do this once across all repos using our CLA.\n",
      "\n",
      "This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\n",
      "For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\n",
      "contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "\n",
      "## Contributors Wall\n",
      "<a href=\"https://github.com/microsoft/autogen/graphs/contributors\">\n",
      "  <img src=\"https://contrib.rocks/image?repo=microsoft/autogen&max=204\" />\n",
      "</a>\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "\n",
      "# Legal Notices\n",
      "\n",
      "Microsoft and any contributors grant you a license to the Microsoft documentation and other content\n",
      "in this repository under the [Creative Commons Attribution 4.0 International Public License](https://creativecommons.org/licenses/by/4.0/legalcode),\n",
      "see the [LICENSE](LICENSE) file, and grant you a license to any code in the repository under the [MIT License](https://opensource.org/licenses/MIT), see the\n",
      "[LICENSE-CODE](LICENSE-CODE) file.\n",
      "\n",
      "Microsoft, Windows, Microsoft Azure, and/or other Microsoft products and services referenced in the documentation\n",
      "may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries.\n",
      "The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks.\n",
      "Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.\n",
      "\n",
      "Privacy information can be found at https://privacy.microsoft.com/en-us/\n",
      "\n",
      "Microsoft and any contributors reserve all other rights, whether under their respective copyrights, patents,\n",
      "or trademarks, whether by implication, estoppel, or otherwise.\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "image icon\n",
      "ChatGPT\n",
      "<a name=\"readme-top\"></a>\n",
      "\n",
      "[![PyPI version](https://badge.fury.io/py/pyautogen.svg)](https://badge.fury.io/py/pyautogen)\n",
      "[![Build](https://github.com/microsoft/autogen/actions/workflows/python-package.yml/badge.svg)](https://github.com/microsoft/autogen/actions/workflows/python-package.yml)\n",
      "![Python Version](https://img.shields.io/badge/3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)\n",
      "[![Downloads](https://static.pepy.tech/badge/pyautogen/week)](https://pepy.tech/project/pyautogen)\n",
      "[![Discord](https://img.shields.io/discord/1153072414184452236?logo=discord&style=flat)](https://aka.ms/autogen-dc)\n",
      "[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40pyautogen)](https://twitter.com/pyautogen)\n",
      "\n",
      "[![NuGet version](https://badge.fury.io/nu/AutoGen.Core.svg)](https://badge.fury.io/nu/AutoGen.Core)\n",
      "\n",
      "# AutoGen\n",
      "[📚 Cite paper](#related-papers).\n",
      "<!-- <p align=\"center\">\n",
      "    <img src=\"https://github.com/microsoft/autogen/blob/main/website/static/img/flaml.svg\"  width=200>\n",
      "    <br>\n",
      "</p> -->\n",
      ":fire: May 29, 2024: DeepLearning.ai launched a new short course [AI Agentic Design Patterns with AutoGen](https://www.deeplearning.ai/short-courses/ai-agentic-design-patterns-with-autogen), made in collaboration with Microsoft and Penn State University, and taught by AutoGen creators [Chi Wang](https://github.com/sonichi) and [Qingyun Wu](https://github.com/qingyun-wu).\n",
      "\n",
      ":fire: May 24, 2024: Foundation Capital published an article on [Forbes: The Promise of Multi-Agent AI](https://www.forbes.com/sites/joannechen/2024/05/24/the-promise-of-multi-agent-ai/?sh=2c1e4f454d97) and a video [AI in the Real World Episode 2: Exploring Multi-Agent AI and AutoGen with Chi Wang](https://www.youtube.com/watch?v=RLwyXRVvlNk).\n",
      "\n",
      ":fire: May 13, 2024: [The Economist](https://www.economist.com/science-and-technology/2024/05/13/todays-ai-models-are-impressive-teams-of-them-will-be-formidable) published an article about multi-agent systems (MAS) following a January 2024 interview with [Chi Wang](https://github.com/sonichi).\n",
      "\n",
      ":fire: May 11, 2024: [AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation](https://openreview.net/pdf?id=uAjxFFing2) received the best paper award at the [ICLR 2024 LLM Agents Workshop](https://llmagents.github.io/).\n",
      "\n",
      ":fire: Apr 26, 2024: [AutoGen.NET](https://microsoft.github.io/autogen-for-net/) is available for .NET developers!\n",
      "\n",
      ":fire: Apr 17, 2024: Andrew Ng cited AutoGen in [The Batch newsletter](https://www.deeplearning.ai/the-batch/issue-245/) and [What's next for AI agentic workflows](https://youtu.be/sal78ACtGTc?si=JduUzN_1kDnMq0vF) at Sequoia Capital's AI Ascent (Mar 26).\n",
      "\n",
      ":fire: Mar 3, 2024: What's new in AutoGen? 📰[Blog](https://microsoft.github.io/autogen/blog/2024/03/03/AutoGen-Update); 📺[Youtube](https://www.youtube.com/watch?v=j_mtwQiaLGU).\n",
      "\n",
      ":fire: Mar 1, 2024: the first AutoGen multi-agent experiment on the challenging [GAIA](https://huggingface.co/spaces/gaia-benchmark/leaderboard) benchmark achieved the No. 1 accuracy in all the three levels.\n",
      "\n",
      "<!-- :tada: Jan 30, 2024: AutoGen is highlighted by Peter Lee in Microsoft Research Forum [Keynote](https://t.co/nUBSjPDjqD). -->\n",
      "\n",
      ":tada: Dec 31, 2023: [AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Framework](https://arxiv.org/abs/2308.08155) is selected by [TheSequence: My Five Favorite AI Papers of 2023](https://thesequence.substack.com/p/my-five-favorite-ai-papers-of-2023).\n",
      "\n",
      "<!-- :fire: Nov 24: pyautogen [v0.2](https://github.com/microsoft/autogen/releases/tag/v0.2.0) is released with many updates and new features compared to v0.1.1. It switches to using openai-python v1. Please read the [migration guide](https://microsoft.github.io/autogen/docs/Installation#python). -->\n",
      "\n",
      "<!-- :fire: Nov 11: OpenAI's Assistants are available in AutoGen and interoperatable with other AutoGen agents! Checkout our [blogpost](https://microsoft.github.io/autogen/blog/2023/11/13/OAI-assistants) for details and examples. -->\n",
      "\n",
      ":tada: Nov 8, 2023: AutoGen is selected into [Open100: Top 100 Open Source achievements](https://www.benchcouncil.org/evaluation/opencs/annual.html) 35 days after spinoff from [FLAML](https://github.com/microsoft/FLAML).\n",
      "\n",
      "<!-- :tada: Nov 6, 2023: AutoGen is mentioned by Satya Nadella in a [fireside chat](https://youtu.be/0pLBvgYtv6U). -->\n",
      "\n",
      "<!-- :tada: Nov 1, 2023: AutoGen is the top trending repo on GitHub in October 2023. -->\n",
      "\n",
      "<!-- :tada: Oct 03, 2023: AutoGen spins off from [FLAML](https://github.com/microsoft/FLAML) on GitHub. -->\n",
      "\n",
      "<!-- :tada: Aug 16: Paper about AutoGen on [arxiv](https://arxiv.org/abs/2308.08155). -->\n",
      "\n",
      ":tada: Mar 29, 2023: AutoGen is first created in [FLAML](https://github.com/microsoft/FLAML).\n",
      "\n",
      "<!--\n",
      ":fire: FLAML is highlighted in OpenAI's [cookbook](https://github.com/openai/openai-cookbook#related-resources-from-around-the-web).\n",
      "\n",
      ":fire: [autogen](https://microsoft.github.io/autogen/) is released with support for ChatGPT and GPT-4, based on [Cost-Effective Hyperparameter Optimization for Large Language Model Generation Inference](https://arxiv.org/abs/2303.04673).\n",
      "\n",
      ":fire: FLAML supports Code-First AutoML & Tuning – Private Preview in [Microsoft Fabric Data Science](https://learn.microsoft.com/en-us/fabric/data-science/). -->\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "\n",
      "## What is AutoGen\n",
      "\n",
      "AutoGen is an open-source programming framework for building AI agents and facilitating cooperation among multiple agents to solve tasks. AutoGen aims to streamline the development and research of agentic AI, much like PyTorch does for Deep Learning. It offers features such as agents capable of interacting with each other, facilitates the use of various large language models (LLMs) and tool use support, autonomous and human-in-the-loop workflows, and multi-agent conversation patterns.\n",
      "\n",
      "**Open Source Statement**: The project welcomes contributions from developers and organizations worldwide. Our goal is to foster a collaborative and inclusive community where diverse perspectives and expertise can drive innovation and enhance the project's capabilities. Whether you are an individual contributor or represent an organization, we invite you to join us in shaping the future of this project. Together, we can build something truly remarkable.\n",
      "\n",
      "The project is currently maintained by a [dynamic group of volunteers](https://butternut-swordtail-8a5.notion.site/410675be605442d3ada9a42eb4dfef30?v=fa5d0a79fd3d4c0f9c112951b2831cbb&pvs=4) from several different organizations. Contact project administrators Chi Wang and Qingyun Wu via auto-gen@outlook.com if you are interested in becoming a maintainer.\n",
      "\n",
      "\n",
      "![AutoGen Overview](https://github.com/microsoft/autogen/blob/main/website/static/img/autogen_agentchat.png)\n",
      "\n",
      "- AutoGen enables building next-gen LLM applications based on [multi-agent conversations](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies the orchestration, automation, and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcomes their weaknesses.\n",
      "- It supports [diverse conversation patterns](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns) for complex workflows. With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy,\n",
      "  the number of agents, and agent conversation topology.\n",
      "- It provides a collection of working systems with different complexities. These systems span a [wide range of applications](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen) from various domains and complexities. This demonstrates how AutoGen can easily support diverse conversation patterns.\n",
      "- AutoGen provides [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification). It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc.\n",
      "\n",
      "AutoGen is created out of collaborative [research](https://microsoft.github.io/autogen/docs/Research) from Microsoft, Penn State University, and the University of Washington.\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "\n",
      "## Roadmaps\n",
      "\n",
      "To see what we are working on and what we plan to work on, please check our\n",
      "[Roadmap Issues](https://aka.ms/autogen-roadmap).\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "\n",
      "## Quickstart\n",
      "The easiest way to start playing is\n",
      "1. Click below to use the GitHub Codespace\n",
      "\n",
      "    [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/autogen?quickstart=1)\n",
      "\n",
      " 2. Copy OAI_CONFIG_LIST_sample to ./notebook folder, name to OAI_CONFIG_LIST, and set the correct configuration.\n",
      " 3. Start playing with the notebooks!\n",
      "\n",
      "*NOTE*: OAI_CONFIG_LIST_sample lists GPT-4 as the default model, as this represents our current recommendation, and is known to work well with AutoGen. If you use a model other than GPT-4, you may need to revise various system prompts (especially if using weaker models like GPT-3.5-turbo). Moreover, if you use models other than those hosted by OpenAI or Azure, you may incur additional risks related to alignment and safety. Proceed with caution if updating this default.\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "\n",
      "## [Installation](https://microsoft.github.io/autogen/docs/Installation)\n",
      "### Option 1. Install and Run AutoGen in Docker\n",
      "\n",
      "Find detailed instructions for users [here](https://microsoft.github.io/autogen/docs/installation/Docker#step-1-install-docker), and for developers [here](https://microsoft.github.io/autogen/docs/Contribute#docker-for-development).\n",
      "\n",
      "### Option 2. Install AutoGen Locally\n",
      "\n",
      "AutoGen requires **Python version >= 3.8, < 3.13**. It can be installed from pip:\n",
      "\n",
      "```bash\n",
      "pip install pyautogen\n",
      "```\n",
      "\n",
      "Minimal dependencies are installed without extra options. You can install extra options based on the feature you need.\n",
      "\n",
      "<!-- For example, use the following to install the dependencies needed by the [`blendsearch`](https://microsoft.github.io/FLAML/docs/Use-Cases/Tune-User-Defined-Function#blendsearch-economical-hyperparameter-optimization-with-blended-search-strategy) option.\n",
      "```bash\n",
      "pip install \"pyautogen[blendsearch]\"\n",
      "``` -->\n",
      "\n",
      "Find more options in [Installation](https://microsoft.github.io/autogen/docs/Installation#option-2-install-autogen-locally-using-virtual-environment).\n",
      "\n",
      "<!-- Each of the [`notebook examples`](https://github.com/microsoft/autogen/tree/main/notebook) may require a specific option to be installed. -->\n",
      "\n",
      "Even if you are installing and running AutoGen locally outside of docker, the recommendation and default behavior of agents is to perform [code execution](https://microsoft.github.io/autogen/docs/FAQ/#code-execution) in docker. Find more instructions and how to change the default behaviour [here](https://microsoft.github.io/autogen/docs/Installation#code-execution-with-docker-(default)).\n",
      "\n",
      "For LLM inference configurations, check the [FAQs](https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints).\n",
      "\n",
      "<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\n",
      "  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\n",
      "    ↑ Back to Top ↑\n",
      "  </a>\n",
      "</p>\n",
      "\n",
      "## Multi-Agent Conversation Framework\n",
      "\n",
      "\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "[autogen.oai.client: 07-24 06:59:45] {329} WARNING - Model qwen2:7b is not found. The cost will be 0. In your config_list, add field {\"price\" : [prompt_price_per_1k, completion_token_price_per_1k]} for customized pricing.\n",
      "\u001b[33massistant\u001b[0m (to ragproxyagent):\n",
      "\n",
      "AutoGen is a multi-agent conversation framework that utilizes artificial intelligence (AI) agents to facilitate complex interactions, enabling users or other systems to communicate effectively with sophisticated AI models like GPT-3.5 and GPT-4 from OpenAI and Azure, among others.\n",
      "\n",
      "### **Core Features**:\n",
      "\n",
      "1. **Advanced Inference**: AutoGen offers enhanced inference capabilities through features like API unification and caching, making the process more efficient and streamlined.\n",
      "\n",
      "2. **Advanced Usage Patterns**: It includes advanced usage patterns such as error handling, multi-config inference, context programming, and more, providing a robust environment for AI-driven applications.\n",
      "\n",
      "3. **Research Backed Development**: AutoGen is the product of collaborative research from Microsoft, Penn State University, and the University of Washington, ensuring cutting-edge development and innovation in its design.\n",
      "\n",
      "### **Roadmap**:\n",
      "\n",
      "The roadmap indicates ongoing developments focusing on improvements, new features, optimizations, and addressing user feedback to enhance the performance and usability of the framework further.\n",
      "\n",
      "### **Quickstart Guide**:\n",
      "\n",
      "To get started with AutoGen easily:\n",
      "1. Use GitHub Codespaces for a quick deployment.\n",
      "2. Copy an example configuration file (`OAI_CONFIG_LIST_sample`) into your workspace, rename it as `OAI_CONFIG_LIST`, and adjust settings accordingly to suit your needs.\n",
      "\n",
      "### **Installation Options**:\n",
      "\n",
      "- **Option 1**: Install and run AutoGen in Docker by following detailed instructions found on the project's documentation pages.\n",
      "- **Option 2**: Install AutoGen locally using a Python virtual environment. This involves executing pip install commands or using setup files provided with the package for various feature sets.\n",
      "\n",
      "### **Docker Usage**:\n",
      "\n",
      "AutoGen is designed to leverage Docker by default for code execution, which helps in isolating dependencies and ensuring consistent environments across different platforms and development settings.\n",
      "\n",
      "### **Configuration Customization**:\n",
      "\n",
      "Ensure that your API endpoints are correctly configured based on whether you're using the provided defaults or custom models. This includes setting up OpenAI keys and Azure service configurations as needed.\n",
      "\n",
      "By following these guidelines, users can effectively set up and utilize AutoGen for a variety of tasks requiring sophisticated AI interactions and decision-making capabilities.\n",
      "\n",
      "--------------------------------------------------------------------------------\n",
      "\u001b[31m\n",
      ">>>>>>>> NO HUMAN INPUT RECEIVED.\u001b[0m\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "ChatResult(chat_id=None, chat_history=[{'content': 'You\\'re a retrieve augmented chatbot. You answer user\\'s questions based on your own knowledge and the\\ncontext provided by the user.\\nIf you can\\'t answer the question with or without the current context, you should reply exactly `UPDATE CONTEXT`.\\nYou must give as short an answer as possible.\\n\\nUser\\'s question is: What is autogen?\\n\\nContext is: Autogen enables the next-gen LLM applications with a generic [multi-agent conversation](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) framework. It offers customizable and conversable agents that integrate LLMs, tools, and humans.\\nBy automating chat among multiple capable agents, one can easily make them collectively perform tasks autonomously or with human feedback, including tasks that require using tools via code.\\n\\nFeatures of this use case include:\\n\\n- **Multi-agent conversations**: AutoGen agents can communicate with each other to solve tasks. This allows for more complex and sophisticated applications than would be possible with a single LLM.\\n- **Customization**: AutoGen agents can be customized to meet the specific needs of an application. This includes the ability to choose the LLMs to use, the types of human input to allow, and the tools to employ.\\n- **Human participation**: AutoGen seamlessly allows human participation. This means that humans can provide input and feedback to the agents as needed.\\n\\nFor [example](https://github.com/microsoft/autogen/blob/main/test/twoagent.py),\\n\\n```python\\nfrom autogen import AssistantAgent, UserProxyAgent, config_list_from_json\\n# Load LLM inference endpoints from an env variable or a file\\n# See https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints\\n# and OAI_CONFIG_LIST_sample\\nconfig_list = config_list_from_json(env_or_file=\"OAI_CONFIG_LIST\")\\n# You can also set config_list directly as a list, for example, config_list = [{\\'model\\': \\'gpt-4\\', \\'api_key\\': \\'<your OpenAI API key here>\\'},]\\nassistant = AssistantAgent(\"assistant\", llm_config={\"config_list\": config_list})\\nuser_proxy = UserProxyAgent(\"user_proxy\", code_execution_config={\"work_dir\": \"coding\", \"use_docker\": False}) # IMPORTANT: set to True to run code in docker, recommended\\nuser_proxy.initiate_chat(assistant, message=\"Plot a chart of NVDA and TESLA stock price change YTD.\")\\n# This initiates an automated chat between the two agents to solve the task\\n```\\n\\nThis example can be run with\\n\\n```python\\npython test/twoagent.py\\n```\\n\\nAfter the repo is cloned.\\nThe figure below shows an example conversation flow with AutoGen.\\n![Agent Chat Example](https://github.com/microsoft/autogen/blob/main/website/static/img/chat_example.png)\\n\\nAlternatively, the [sample code](https://github.com/microsoft/autogen/blob/main/samples/simple_chat.py) here allows a user to chat with an AutoGen agent in ChatGPT style.\\nPlease find more [code examples](https://microsoft.github.io/autogen/docs/Examples#automated-multi-agent-chat) for this feature.\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\n\\n## Enhanced LLM Inferences\\n\\nAutogen also helps maximize the utility out of the expensive LLMs such as ChatGPT and GPT-4. It offers [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification) with powerful functionalities like caching, error handling, multi-config inference and templating.\\n\\n<!-- For example, you can optimize generations by LLM with your own tuning data, success metrics, and budgets.\\n\\n```python\\n# perform tuning for openai<1\\nconfig, analysis = autogen.Completion.tune(\\n    data=tune_data,\\n    metric=\"success\",\\n    mode=\"max\",\\n    eval_func=eval_func,\\n    inference_budget=0.05,\\n    optimization_budget=3,\\n    num_samples=-1,\\n)\\n# perform inference for a test instance\\nresponse = autogen.Completion.create(context=test_instance, **config)\\n```\\n\\nPlease find more [code examples](https://microsoft.github.io/autogen/docs/Examples#tune-gpt-models) for this feature. -->\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\n\\n## Documentation\\n\\nYou can find detailed documentation about AutoGen [here](https://microsoft.github.io/autogen/).\\n\\nIn addition, you can find:\\n\\n- [Research](https://microsoft.github.io/autogen/docs/Research), [blogposts](https://microsoft.github.io/autogen/blog) around AutoGen, and [Transparency FAQs](https://github.com/microsoft/autogen/blob/main/TRANSPARENCY_FAQS.md)\\n\\n- [Discord](https://aka.ms/autogen-dc)\\n\\n- [Contributing guide](https://microsoft.github.io/autogen/docs/Contribute)\\n\\n- [Roadmap](https://github.com/orgs/microsoft/projects/989/views/3)\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\n\\n## Related Papers\\n\\n[AutoGen](https://arxiv.org/abs/2308.08155)\\n\\n```\\n@inproceedings{wu2023autogen,\\n      title={AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Framework},\\n      author={Qingyun Wu and Gagan Bansal and Jieyu Zhang and Yiran Wu and Beibin Li and Erkang Zhu and Li Jiang and Xiaoyun Zhang and Shaokun Zhang and Jiale Liu and Ahmed Hassan Awadallah and Ryen W White and Doug Burger and Chi Wang},\\n      year={2023},\\n      eprint={2308.08155},\\n      archivePrefix={arXiv},\\n      primaryClass={cs.AI}\\n}\\n```\\n\\n[EcoOptiGen](https://arxiv.org/abs/2303.04673)\\n\\n```\\n@inproceedings{wang2023EcoOptiGen,\\n    title={Cost-Effective Hyperparameter Optimization for Large Language Model Generation Inference},\\n    author={Chi Wang and Susan Xueqing Liu and Ahmed H. Awadallah},\\n    year={2023},\\n    booktitle={AutoML\\'23},\\n}\\n```\\n\\n[MathChat](https://arxiv.org/abs/2306.01337)\\n\\n```\\n@inproceedings{wu2023empirical,\\n    title={An Empirical Study on Challenging Math Problem Solving with GPT-4},\\n    author={Yiran Wu and Feiran Jia and Shaokun Zhang and Hangyu Li and Erkang Zhu and Yue Wang and Yin Tat Lee and Richard Peng and Qingyun Wu and Chi Wang},\\n    year={2023},\\n    booktitle={ArXiv preprint arXiv:2306.01337},\\n}\\n```\\n\\n[AgentOptimizer](https://arxiv.org/pdf/2402.11359)\\n\\n```\\n@article{zhang2024training,\\n  title={Training Language Model Agents without Modifying Language Models},\\n  author={Zhang, Shaokun and Zhang, Jieyu and Liu, Jiale and Song, Linxin and Wang, Chi and Krishna, Ranjay and Wu, Qingyun},\\n  journal={ICML\\'24},\\n  year={2024}\\n}\\n```\\n\\n[StateFlow](https://arxiv.org/abs/2403.11322)\\n```\\n@article{wu2024stateflow,\\n  title={StateFlow: Enhancing LLM Task-Solving through State-Driven Workflows},\\n  author={Wu, Yiran and Yue, Tianwei and Zhang, Shaokun and Wang, Chi and Wu, Qingyun},\\n  journal={arXiv preprint arXiv:2403.11322},\\n  year={2024}\\n}\\n```\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\n\\n## Contributing\\n\\nThis project welcomes contributions and suggestions. Most contributions require you to agree to a\\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\\nthe rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>.\\n\\nIf you are new to GitHub, [here](https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution) is a detailed help source on getting involved with development on GitHub.\\n\\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\\nprovided by the bot. You will only need to do this once across all repos using our CLA.\\n\\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\\nFor more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\n\\n## Contributors Wall\\n<a href=\"https://github.com/microsoft/autogen/graphs/contributors\">\\n  <img src=\"https://contrib.rocks/image?repo=microsoft/autogen&max=204\" />\\n</a>\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\n\\n# Legal Notices\\n\\nMicrosoft and any contributors grant you a license to the Microsoft documentation and other content\\nin this repository under the [Creative Commons Attribution 4.0 International Public License](https://creativecommons.org/licenses/by/4.0/legalcode),\\nsee the [LICENSE](LICENSE) file, and grant you a license to any code in the repository under the [MIT License](https://opensource.org/licenses/MIT), see the\\n[LICENSE-CODE](LICENSE-CODE) file.\\n\\nMicrosoft, Windows, Microsoft Azure, and/or other Microsoft products and services referenced in the documentation\\nmay be either trademarks or registered trademarks of Microsoft in the United States and/or other countries.\\nThe licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks.\\nMicrosoft\\'s general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.\\n\\nPrivacy information can be found at https://privacy.microsoft.com/en-us/\\n\\nMicrosoft and any contributors reserve all other rights, whether under their respective copyrights, patents,\\nor trademarks, whether by implication, estoppel, or otherwise.\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\nimage icon\\nChatGPT\\n<a name=\"readme-top\"></a>\\n\\n[![PyPI version](https://badge.fury.io/py/pyautogen.svg)](https://badge.fury.io/py/pyautogen)\\n[![Build](https://github.com/microsoft/autogen/actions/workflows/python-package.yml/badge.svg)](https://github.com/microsoft/autogen/actions/workflows/python-package.yml)\\n![Python Version](https://img.shields.io/badge/3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)\\n[![Downloads](https://static.pepy.tech/badge/pyautogen/week)](https://pepy.tech/project/pyautogen)\\n[![Discord](https://img.shields.io/discord/1153072414184452236?logo=discord&style=flat)](https://aka.ms/autogen-dc)\\n[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40pyautogen)](https://twitter.com/pyautogen)\\n\\n[![NuGet version](https://badge.fury.io/nu/AutoGen.Core.svg)](https://badge.fury.io/nu/AutoGen.Core)\\n\\n# AutoGen\\n[📚 Cite paper](#related-papers).\\n<!-- <p align=\"center\">\\n    <img src=\"https://github.com/microsoft/autogen/blob/main/website/static/img/flaml.svg\"  width=200>\\n    <br>\\n</p> -->\\n:fire: May 29, 2024: DeepLearning.ai launched a new short course [AI Agentic Design Patterns with AutoGen](https://www.deeplearning.ai/short-courses/ai-agentic-design-patterns-with-autogen), made in collaboration with Microsoft and Penn State University, and taught by AutoGen creators [Chi Wang](https://github.com/sonichi) and [Qingyun Wu](https://github.com/qingyun-wu).\\n\\n:fire: May 24, 2024: Foundation Capital published an article on [Forbes: The Promise of Multi-Agent AI](https://www.forbes.com/sites/joannechen/2024/05/24/the-promise-of-multi-agent-ai/?sh=2c1e4f454d97) and a video [AI in the Real World Episode 2: Exploring Multi-Agent AI and AutoGen with Chi Wang](https://www.youtube.com/watch?v=RLwyXRVvlNk).\\n\\n:fire: May 13, 2024: [The Economist](https://www.economist.com/science-and-technology/2024/05/13/todays-ai-models-are-impressive-teams-of-them-will-be-formidable) published an article about multi-agent systems (MAS) following a January 2024 interview with [Chi Wang](https://github.com/sonichi).\\n\\n:fire: May 11, 2024: [AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation](https://openreview.net/pdf?id=uAjxFFing2) received the best paper award at the [ICLR 2024 LLM Agents Workshop](https://llmagents.github.io/).\\n\\n:fire: Apr 26, 2024: [AutoGen.NET](https://microsoft.github.io/autogen-for-net/) is available for .NET developers!\\n\\n:fire: Apr 17, 2024: Andrew Ng cited AutoGen in [The Batch newsletter](https://www.deeplearning.ai/the-batch/issue-245/) and [What\\'s next for AI agentic workflows](https://youtu.be/sal78ACtGTc?si=JduUzN_1kDnMq0vF) at Sequoia Capital\\'s AI Ascent (Mar 26).\\n\\n:fire: Mar 3, 2024: What\\'s new in AutoGen? 📰[Blog](https://microsoft.github.io/autogen/blog/2024/03/03/AutoGen-Update); 📺[Youtube](https://www.youtube.com/watch?v=j_mtwQiaLGU).\\n\\n:fire: Mar 1, 2024: the first AutoGen multi-agent experiment on the challenging [GAIA](https://huggingface.co/spaces/gaia-benchmark/leaderboard) benchmark achieved the No. 1 accuracy in all the three levels.\\n\\n<!-- :tada: Jan 30, 2024: AutoGen is highlighted by Peter Lee in Microsoft Research Forum [Keynote](https://t.co/nUBSjPDjqD). -->\\n\\n:tada: Dec 31, 2023: [AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation Framework](https://arxiv.org/abs/2308.08155) is selected by [TheSequence: My Five Favorite AI Papers of 2023](https://thesequence.substack.com/p/my-five-favorite-ai-papers-of-2023).\\n\\n<!-- :fire: Nov 24: pyautogen [v0.2](https://github.com/microsoft/autogen/releases/tag/v0.2.0) is released with many updates and new features compared to v0.1.1. It switches to using openai-python v1. Please read the [migration guide](https://microsoft.github.io/autogen/docs/Installation#python). -->\\n\\n<!-- :fire: Nov 11: OpenAI\\'s Assistants are available in AutoGen and interoperatable with other AutoGen agents! Checkout our [blogpost](https://microsoft.github.io/autogen/blog/2023/11/13/OAI-assistants) for details and examples. -->\\n\\n:tada: Nov 8, 2023: AutoGen is selected into [Open100: Top 100 Open Source achievements](https://www.benchcouncil.org/evaluation/opencs/annual.html) 35 days after spinoff from [FLAML](https://github.com/microsoft/FLAML).\\n\\n<!-- :tada: Nov 6, 2023: AutoGen is mentioned by Satya Nadella in a [fireside chat](https://youtu.be/0pLBvgYtv6U). -->\\n\\n<!-- :tada: Nov 1, 2023: AutoGen is the top trending repo on GitHub in October 2023. -->\\n\\n<!-- :tada: Oct 03, 2023: AutoGen spins off from [FLAML](https://github.com/microsoft/FLAML) on GitHub. -->\\n\\n<!-- :tada: Aug 16: Paper about AutoGen on [arxiv](https://arxiv.org/abs/2308.08155). -->\\n\\n:tada: Mar 29, 2023: AutoGen is first created in [FLAML](https://github.com/microsoft/FLAML).\\n\\n<!--\\n:fire: FLAML is highlighted in OpenAI\\'s [cookbook](https://github.com/openai/openai-cookbook#related-resources-from-around-the-web).\\n\\n:fire: [autogen](https://microsoft.github.io/autogen/) is released with support for ChatGPT and GPT-4, based on [Cost-Effective Hyperparameter Optimization for Large Language Model Generation Inference](https://arxiv.org/abs/2303.04673).\\n\\n:fire: FLAML supports Code-First AutoML & Tuning – Private Preview in [Microsoft Fabric Data Science](https://learn.microsoft.com/en-us/fabric/data-science/). -->\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\n\\n## What is AutoGen\\n\\nAutoGen is an open-source programming framework for building AI agents and facilitating cooperation among multiple agents to solve tasks. AutoGen aims to streamline the development and research of agentic AI, much like PyTorch does for Deep Learning. It offers features such as agents capable of interacting with each other, facilitates the use of various large language models (LLMs) and tool use support, autonomous and human-in-the-loop workflows, and multi-agent conversation patterns.\\n\\n**Open Source Statement**: The project welcomes contributions from developers and organizations worldwide. Our goal is to foster a collaborative and inclusive community where diverse perspectives and expertise can drive innovation and enhance the project\\'s capabilities. Whether you are an individual contributor or represent an organization, we invite you to join us in shaping the future of this project. Together, we can build something truly remarkable.\\n\\nThe project is currently maintained by a [dynamic group of volunteers](https://butternut-swordtail-8a5.notion.site/410675be605442d3ada9a42eb4dfef30?v=fa5d0a79fd3d4c0f9c112951b2831cbb&pvs=4) from several different organizations. Contact project administrators Chi Wang and Qingyun Wu via auto-gen@outlook.com if you are interested in becoming a maintainer.\\n\\n\\n![AutoGen Overview](https://github.com/microsoft/autogen/blob/main/website/static/img/autogen_agentchat.png)\\n\\n- AutoGen enables building next-gen LLM applications based on [multi-agent conversations](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat) with minimal effort. It simplifies the orchestration, automation, and optimization of a complex LLM workflow. It maximizes the performance of LLM models and overcomes their weaknesses.\\n- It supports [diverse conversation patterns](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#supporting-diverse-conversation-patterns) for complex workflows. With customizable and conversable agents, developers can use AutoGen to build a wide range of conversation patterns concerning conversation autonomy,\\n  the number of agents, and agent conversation topology.\\n- It provides a collection of working systems with different complexities. These systems span a [wide range of applications](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat#diverse-applications-implemented-with-autogen) from various domains and complexities. This demonstrates how AutoGen can easily support diverse conversation patterns.\\n- AutoGen provides [enhanced LLM inference](https://microsoft.github.io/autogen/docs/Use-Cases/enhanced_inference#api-unification). It offers utilities like API unification and caching, and advanced usage patterns, such as error handling, multi-config inference, context programming, etc.\\n\\nAutoGen is created out of collaborative [research](https://microsoft.github.io/autogen/docs/Research) from Microsoft, Penn State University, and the University of Washington.\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\n\\n## Roadmaps\\n\\nTo see what we are working on and what we plan to work on, please check our\\n[Roadmap Issues](https://aka.ms/autogen-roadmap).\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\n\\n## Quickstart\\nThe easiest way to start playing is\\n1. Click below to use the GitHub Codespace\\n\\n    [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/autogen?quickstart=1)\\n\\n 2. Copy OAI_CONFIG_LIST_sample to ./notebook folder, name to OAI_CONFIG_LIST, and set the correct configuration.\\n 3. Start playing with the notebooks!\\n\\n*NOTE*: OAI_CONFIG_LIST_sample lists GPT-4 as the default model, as this represents our current recommendation, and is known to work well with AutoGen. If you use a model other than GPT-4, you may need to revise various system prompts (especially if using weaker models like GPT-3.5-turbo). Moreover, if you use models other than those hosted by OpenAI or Azure, you may incur additional risks related to alignment and safety. Proceed with caution if updating this default.\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\n\\n## [Installation](https://microsoft.github.io/autogen/docs/Installation)\\n### Option 1. Install and Run AutoGen in Docker\\n\\nFind detailed instructions for users [here](https://microsoft.github.io/autogen/docs/installation/Docker#step-1-install-docker), and for developers [here](https://microsoft.github.io/autogen/docs/Contribute#docker-for-development).\\n\\n### Option 2. Install AutoGen Locally\\n\\nAutoGen requires **Python version >= 3.8, < 3.13**. It can be installed from pip:\\n\\n```bash\\npip install pyautogen\\n```\\n\\nMinimal dependencies are installed without extra options. You can install extra options based on the feature you need.\\n\\n<!-- For example, use the following to install the dependencies needed by the [`blendsearch`](https://microsoft.github.io/FLAML/docs/Use-Cases/Tune-User-Defined-Function#blendsearch-economical-hyperparameter-optimization-with-blended-search-strategy) option.\\n```bash\\npip install \"pyautogen[blendsearch]\"\\n``` -->\\n\\nFind more options in [Installation](https://microsoft.github.io/autogen/docs/Installation#option-2-install-autogen-locally-using-virtual-environment).\\n\\n<!-- Each of the [`notebook examples`](https://github.com/microsoft/autogen/tree/main/notebook) may require a specific option to be installed. -->\\n\\nEven if you are installing and running AutoGen locally outside of docker, the recommendation and default behavior of agents is to perform [code execution](https://microsoft.github.io/autogen/docs/FAQ/#code-execution) in docker. Find more instructions and how to change the default behaviour [here](https://microsoft.github.io/autogen/docs/Installation#code-execution-with-docker-(default)).\\n\\nFor LLM inference configurations, check the [FAQs](https://microsoft.github.io/autogen/docs/FAQ#set-your-api-endpoints).\\n\\n<p align=\"right\" style=\"font-size: 14px; color: #555; margin-top: 20px;\">\\n  <a href=\"#readme-top\" style=\"text-decoration: none; color: blue; font-weight: bold;\">\\n    ↑ Back to Top ↑\\n  </a>\\n</p>\\n\\n## Multi-Agent Conversation Framework\\n\\n', 'role': 'assistant'}, {'content': \"AutoGen is a multi-agent conversation framework that utilizes artificial intelligence (AI) agents to facilitate complex interactions, enabling users or other systems to communicate effectively with sophisticated AI models like GPT-3.5 and GPT-4 from OpenAI and Azure, among others.\\n\\n### **Core Features**:\\n\\n1. **Advanced Inference**: AutoGen offers enhanced inference capabilities through features like API unification and caching, making the process more efficient and streamlined.\\n\\n2. **Advanced Usage Patterns**: It includes advanced usage patterns such as error handling, multi-config inference, context programming, and more, providing a robust environment for AI-driven applications.\\n\\n3. **Research Backed Development**: AutoGen is the product of collaborative research from Microsoft, Penn State University, and the University of Washington, ensuring cutting-edge development and innovation in its design.\\n\\n### **Roadmap**:\\n\\nThe roadmap indicates ongoing developments focusing on improvements, new features, optimizations, and addressing user feedback to enhance the performance and usability of the framework further.\\n\\n### **Quickstart Guide**:\\n\\nTo get started with AutoGen easily:\\n1. Use GitHub Codespaces for a quick deployment.\\n2. Copy an example configuration file (`OAI_CONFIG_LIST_sample`) into your workspace, rename it as `OAI_CONFIG_LIST`, and adjust settings accordingly to suit your needs.\\n\\n### **Installation Options**:\\n\\n- **Option 1**: Install and run AutoGen in Docker by following detailed instructions found on the project's documentation pages.\\n- **Option 2**: Install AutoGen locally using a Python virtual environment. This involves executing pip install commands or using setup files provided with the package for various feature sets.\\n\\n### **Docker Usage**:\\n\\nAutoGen is designed to leverage Docker by default for code execution, which helps in isolating dependencies and ensuring consistent environments across different platforms and development settings.\\n\\n### **Configuration Customization**:\\n\\nEnsure that your API endpoints are correctly configured based on whether you're using the provided defaults or custom models. This includes setting up OpenAI keys and Azure service configurations as needed.\\n\\nBy following these guidelines, users can effectively set up and utilize AutoGen for a variety of tasks requiring sophisticated AI interactions and decision-making capabilities.\", 'role': 'user'}], summary=\"AutoGen is a multi-agent conversation framework that utilizes artificial intelligence (AI) agents to facilitate complex interactions, enabling users or other systems to communicate effectively with sophisticated AI models like GPT-3.5 and GPT-4 from OpenAI and Azure, among others.\\n\\n### **Core Features**:\\n\\n1. **Advanced Inference**: AutoGen offers enhanced inference capabilities through features like API unification and caching, making the process more efficient and streamlined.\\n\\n2. **Advanced Usage Patterns**: It includes advanced usage patterns such as error handling, multi-config inference, context programming, and more, providing a robust environment for AI-driven applications.\\n\\n3. **Research Backed Development**: AutoGen is the product of collaborative research from Microsoft, Penn State University, and the University of Washington, ensuring cutting-edge development and innovation in its design.\\n\\n### **Roadmap**:\\n\\nThe roadmap indicates ongoing developments focusing on improvements, new features, optimizations, and addressing user feedback to enhance the performance and usability of the framework further.\\n\\n### **Quickstart Guide**:\\n\\nTo get started with AutoGen easily:\\n1. Use GitHub Codespaces for a quick deployment.\\n2. Copy an example configuration file (`OAI_CONFIG_LIST_sample`) into your workspace, rename it as `OAI_CONFIG_LIST`, and adjust settings accordingly to suit your needs.\\n\\n### **Installation Options**:\\n\\n- **Option 1**: Install and run AutoGen in Docker by following detailed instructions found on the project's documentation pages.\\n- **Option 2**: Install AutoGen locally using a Python virtual environment. This involves executing pip install commands or using setup files provided with the package for various feature sets.\\n\\n### **Docker Usage**:\\n\\nAutoGen is designed to leverage Docker by default for code execution, which helps in isolating dependencies and ensuring consistent environments across different platforms and development settings.\\n\\n### **Configuration Customization**:\\n\\nEnsure that your API endpoints are correctly configured based on whether you're using the provided defaults or custom models. This includes setting up OpenAI keys and Azure service configurations as needed.\\n\\nBy following these guidelines, users can effectively set up and utilize AutoGen for a variety of tasks requiring sophisticated AI interactions and decision-making capabilities.\", cost={'usage_including_cached_inference': {'total_cost': 0, 'qwen2:7b': {'cost': 0, 'prompt_tokens': 1026, 'completion_tokens': 436, 'total_tokens': 1462}}, 'usage_excluding_cached_inference': {'total_cost': 0, 'qwen2:7b': {'cost': 0, 'prompt_tokens': 1026, 'completion_tokens': 436, 'total_tokens': 1462}}}, human_input=[''])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "assistant.reset()\n",
    "ragproxyagent.initiate_chat(assistant, message=ragproxyagent.message_generator, problem=\"What is autogen?\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ChatTTS",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
